package com.lc.luzhengtang.activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;

import com.lc.luzhengtang.MainActivity;
import com.lc.luzhengtang.R;
import com.lc.luzhengtang.base.BaseActivity;


public class WelcomeActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
       /* new Handler() {

            @Override
            public void handleMessage(Message msg) {
                startVerifyActivity(BaseApplication.basePreferences2.readIsGuide() ? MainActivity.class : GuideActivity.class);
                finish();
            }

        }.sendEmptyMessageDelayed(0, 2000);*/

        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                // TODO Auto-generated method stub
                SharedPreferences sp = getPreferences(MODE_PRIVATE);
                boolean isOpen = sp.getBoolean("open", false);
                if (isOpen) {
                    startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
                    finish();
                } else {
                    startActivity(new Intent(WelcomeActivity.this, GuideActivity.class));
                    SharedPreferences.Editor editor = sp.edit();
                    editor.putBoolean("open", true);
                    editor.commit();
                    finish();
                }
            }
        }, 3000);


    }
}
